package com.navinfo.platform.trip.common.enums;

import java.util.Arrays;

/**
 * 协议枚举
 * 1 密集数据
 * 2 位置数据
 */
public enum ProtocolEnum {
    REALTIME(1,"密集数据"), LOCATION(2,"位置数据");
    /**
     * 协议编码
     */
    private int type;
    /**
     * 协议描述
     */
    private String desc;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    ProtocolEnum(int type, String desc){
        this.setType(type);
        this.setDesc(desc);
    }

    public static ProtocolEnum valueOf(int type){
        return Arrays.stream(ProtocolEnum.values()).filter(e ->e.type == type).findFirst().get();
    }
}
